package com.ww.springboot.mybatis.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Luobinbin
 * @date 2021/01/14 16:01
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CustomizePage {
    /**
     * 分页查询开始记录位置
     */
    private int begin;
    /**
     * 分页查询结束位置
     */
    private int end;
    /**
     * 每页显示记录数
     */
    private int size;
    /**
     * 当前页码
     */
    private int current;
    /**
     * 总数
     */
    private int count;


    public CustomizePage(int current, int size) {
        if (current < 1) {
            current = 1;
        }
        this.size = size;
        this.current = current;
        this.begin = (current - 1) * size;
        this.end = this.begin + size;
    }

    public CustomizePage(int current, int size, int count) {
        if (current < 1) {
            current = 1;
        }
        this.size = size;
        this.current = current;
        this.begin = (current - 1) * size;
        this.end = this.begin + size;
        this.count = count;
    }
}
